﻿/*
Commerce by Onex – eCommerce software platform (www.ecommerce.byonex.com)
Copyright (C) 2008-2010 by Onex Group

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 */
using System;
using System.Data;
using System.Configuration;
using ShopModel;

namespace ShopModel
{
    /// <summary>
    /// Przechowywanie danych zamówienia (Storing order data)
    /// </summary>
    public struct OrderData
    {
        #region Fields

        private int orderID;
        private string name;
        private string surname;
        private string street;
        private string city;
        private string flat;
        private string building;
        private string phone;
        private string email;
        private string postCode1;
        private string postCode2;
        private bool sendAbroad;
        //private string country;
        private int country;
        private PaymentType payment;
        private int paymentID;
        private AbroadSend sendAbroadType;
        private string info;
        private int shipmentID;
        private ShipmentType shipment;

        private bool isCompany;
        private bool sameAddress;
        private string companyName;
        private string companyNIP;
        private string companyStreet;
        private string companyBuilding;
        private string companyFlat;
        private string companyPostCode1;
        private string companyPostCode2;
        private string companyCity;

        private decimal cost;
        private decimal deliveryCost;

        #endregion

        #region Properties

        public int OrderID
        {
            get { return orderID; }
            set { orderID = value; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string Surname
        {
            get { return surname; }
            set { surname = value; }
        }

        public string Street
        {
            get { return street; }
            set { street = value; }
        }

        public string City
        {
            get { return city; }
            set { city = value; }
        }

        public string Flat
        {
            get { return flat; }
            set { flat = value; }
        }

        public string Building
        {
            get { return building; }
            set { building = value; }
        }

        public string Phone
        {
            get { return phone; }
            set { phone = value; }
        }

        public string EMail
        {
            get { return email; }
            set { email = value; }
        }

        public string PostCode1
        {
            get { return postCode1; }
            set { postCode1 = value; }
        }

        public string PostCode2
        {
            get { return postCode2; }
            set { postCode2 = value; }
        }

        public bool SendAbroad
        {
            get { return sendAbroad; }
            set { sendAbroad = value; }
        }

        public int Country
        {
            get { return country; }
            set { country = value; }
        }

        public int PaymentID
        {
            get { return paymentID; }
            set { paymentID = value; }
        }

        public PaymentType Payment
        {
            get { return payment; }
            set { payment = value; }
        }

        public int ShipmentID
        {
            get { return shipmentID; }
            set { shipmentID = value; }
        }

        public ShipmentType Shipment
        {
            get { return shipment; }
            set { shipment = value; }
        }

        public AbroadSend SendAbroadType
        {
            get { return sendAbroadType; }
            set { sendAbroadType = value; }
        }


        public bool IsCompany
        {
            get { return isCompany; }
            set { isCompany = value; }
        }

        public bool SameAddress
        {
            get { return sameAddress; }
            set { sameAddress = value; }
        }

        public string CompanyName
        {
            get { return companyName; }
            set { companyName = value; }
        }

        public string CompanyNIP
        {
            get { return companyNIP; }
            set { companyNIP = value; }
        }

        public string CompanyStreet
        {
            get { return companyStreet; }
            set { companyStreet = value; }
        }

        public string CompanyBuilding
        {
            get { return companyBuilding; }
            set { companyBuilding = value; }
        }

        public string CompanyFlat
        {
            get { return companyFlat; }
            set { companyFlat = value; }
        }

        public string CompanyPostCode1
        {
            get { return companyPostCode1; }
            set { companyPostCode1 = value; }
        }

        public string CompanyPostCode2
        {
            get { return companyPostCode2; }
            set { companyPostCode2 = value; }
        }

        public string CompanyCity
        {
            get { return companyCity; }
            set { companyCity = value; }
        }

        public decimal Cost
        {
            get { return cost; }
            set { cost = value; }
        }

        public decimal DeliveryCost
        {
            get { return deliveryCost; }
            set { deliveryCost = value; }
        }

        public string Info
        {
            get { return info; }
            set { info = value; }
        }

        public decimal TotalCost
        {
            get
            {
                return cost + deliveryCost;
            }
        }

        public string PostCode
        {
            get
            {
                if (postCode1.Trim() != string.Empty || postCode2.Trim() != string.Empty)
                    return postCode1 + "-" + postCode2;
                else
                    return string.Empty;
            }
        }

        public string CompanyPostCode
        {
            get
            {
                if (companyPostCode1.Trim() != string.Empty || companyPostCode2.Trim() != string.Empty)
                    return companyPostCode1 + "-" + companyPostCode2;
                else
                    return string.Empty;
            }
        }

        #endregion
    }

    public enum AbroadSend
    {
        UE = 1,
        OutUE = 2,
        None = 3,
    }
}
